package com.fzkj.shejimoshi.adapter2.adapter;

import com.fzkj.shejimoshi.adapter2.motor.Motor;

/**
 * @DESCRIPTION: TODO 改进 适配器，不用在为不同的类型创建不同的适配器，使用一个就行
 * @AUTHOR: AnotherOne
 * @DATE: 2021/8/13 15:43
 */
public class AdapterImprove implements Motor {

    private Motor motor;
    public AdapterImprove(Class<? extends Motor> clazz) throws Exception{
        this.motor = clazz.newInstance();
    }

    @Override
    public void drive() {
        this.motor.drive();
    }
}
